package io.vincentwinner.systeminfoapi.dao.impl;

import io.vincentwinner.systeminfoapi.dao.IDiskDao;
import io.vincentwinner.toolset.os.Computer;
import io.vincentwinner.toolset.os.Disk;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @see IDiskDao
 */
@Repository("diskDao")
public class DiskDaoImpl implements IDiskDao {

    private final Disk disk = Computer.getDisk();
    private final List<Disk.DiskHardwareInfo> diskHardwareInfos = disk.getDiskList();
    private final Integer diskNum = diskHardwareInfos.size();

    @Override
    public List<Disk.DiskHardwareInfo> getDiskHardwareInfos() {
        return diskHardwareInfos;
    }

    @Override
    public Long getTotalSpace(int diskNum) {
        return disk.totalSpace(diskNum);
    }

    @Override
    public Long getFreeSpace(int diskNum) {
        return disk.freeSpace(diskNum);
    }

    @Override
    public Long getUsedSpace(int diskNum) {
        return disk.usedSpace(diskNum);
    }

    @Override
    public Double getUsage(int diskNum) {
        return disk.usage(diskNum);
    }


}
